﻿using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace TestImpresion.Clases.Comunes
{
    public static class Utiles
    {
        public static void UncheckElementos(ToggleButton button, UIElementCollection children)
        {
            foreach (var child in children)
            {
                if (child != null && child.GetType() == typeof (StackPanel))
                {
                    UncheckElementos(button,((StackPanel)child).Children);
                }
                else if (child != null && child.GetType() == typeof(ToggleButton))
                {
                    if (button != child && (((ToggleButton)child).IsChecked.HasValue && ((ToggleButton)child).IsChecked.Value))
                    {
                        ((ToggleButton)child).IsChecked = false;
                    }
                }
            }

        }

    }
}
